/******************************************************************************
*
*  MP3Play Widget -- MessageBox
*  Created by Patrick Neeley <patrick@neeley.org>
*             http://www.neeley.org/
*  Created on 2007.08.03
*  Updated on 2007.08.03
*
*  Description:

   A message box component that display a textual message, and an "OK" button.

******************************************************************************/


class MessageBox extends Component
{
  var g_Message : Component;
  var g_Button : Button;

  public function new (data:String, ?w, ?h)
  {
    var root = flash.Lib._root;
    super(root, false);

    if (w <= 0) {
      w = 200;
    }
    if (h <= 0) {
      h = 80;
    }
    var x = (root._width / 2) - (w / 2);
    var y = (root._height / 2) - (h / 2);

    this.move(x,y,w,h);
    this.setVisible(visible);
    this.setColor(0x000000);

    g_Message = new Component(this.mc, true, true);
    g_Message.move(2,2,w-4,h-24);
    g_Message.setColor(0xFFFFFF);
    var f = g_Message.getNewTextFormat();
    f.size = 10;
    f.bold = true;
    g_Message.setNewTextFormat(f);
    g_Message.setText(data);

    g_Button = new Button(this.mc, "OK", true, (w/2) - 20, h - 20, 40, 18);
    var me = this;
    g_Button.onPress = function () { me.destroy(); }
    f = g_Message.getTextFormat();
    f.size = 12;
    f.bold = true;
    f.align = "center";
    g_Button.setTextFormat(f);
  }
  // end function new



  public function destroy ()
  {
    g_Message.destroy();
    delete g_Message;

    g_Button.destroy();
    delete g_Button;

    super.destroy();
  }
  // end function destroy


}
// end class SongEntry
